import java.io.FileNotFoundException;
import java.io.PrintStream;

/**
 * @author Papa Sqauts
This program take in a set amount of arguments, the solution of the tsp solver and rewrites it to file

 */
public class WriteHCP {

PrintStream out ;

public WriteHCP(ReadHCPScanner r, String[] args) throws FileNotFoundException
{
	int dimension = new Integer(args[3]); // takes the dimension from the 4th argument
	Node[] sequence = new Node[dimension];
	
	for(int x =0; x < dimension  ; x++)
	{
		sequence[x] = new Node(0,dimension );
	}
	
	out = new PrintStream(args[2]); // names the file

	out.println("NAME : " + r.name);
if (r.comment != null) 
{
	out.println("COMMENT : " + r.comment);
}
	out.println("TYPE : HCP" );
	out.println("DIMENSION : " + args[3]);
	out.println("EDGE_DATA_FORMAT : EDGE_LIST" );
	out.println("EDGE_DATA_SECTION");
	
	String[] temp = new String[2]; //2 element array 
	int x =4;
	
	
while(!args[x].equals("-1") )//run until-1
	 {
	temp[0] = args[x];
	temp[1] = args[x+1];
	if(args[x+2].equals("1")) // exempts the values of 2 meaning edge is forced
	{
	out.println(args[x] + " " + args[x+1]);
	}
	
	
	sequence[new Integer(args[x])] = new Node(new Integer(args[x]),dimension);
	
	
	x = x +3;
}


	out.close();
}

}